package cn.gxa.j229.bug.finance.service.borrowing.impl;

import cn.gxa.j229.bug.finance.mapper.CategoryMapper;
import cn.gxa.j229.bug.finance.pojo.Category;
import cn.gxa.j229.bug.finance.service.borrowing.CategoryService;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author FanJiang
 * @Date 2020/9/22
 * @Version 1.0
 */

@Service("categoryService")
public class CategoryServiceImpl implements CategoryService {

    @Resource
    CategoryMapper categoryMapper;

    @Override
    public int deleteById(Integer id) {
        return categoryMapper.deleteById(id);
    }

    @Override
    public int insertSelective(Category category) {
        category.setId(null);
        return categoryMapper.insertSelective(category);
    }

    @Override
    public int updateById(Category category) {
        return categoryMapper.updateById(category);
    }

    @Override
    public int updateByIdSelective(Category category) {
        return categoryMapper.updateByIdSelective(category);
    }

    /**
     * 借款标类型
     * 查询所有，页面请求展示
     * @return
     */
    @Override
    public List findAllAndOrder() {
        return categoryMapper.findAllAndOrder();
    }

    /**
     * 标的上架维护
     * 标的类型下拉列表
     * @return
     */
    @Override
    public List findAllList() {
        return categoryMapper.findAllList();
    }

    /**
     * 借款标类别
     * 添加分类
     * @param category
     * @return
     */
    @Override
    public int updateByIdState(Category category) {
        return categoryMapper.updateByIdState(category);
    }
}
